<?php

/**
 * This file is part of the Pagizer package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @copyright   Copyright (c) 2010 Advisa (http://www.advisa.fr)
 * @author      Pagizer Core Team <team@pagizer.org>
 * @package     pagizer
 * @subpackage  medias
 */

class m_medias_actions_block_McePaginationAction extends m_backoffice_extends_Action
{
	public function execute()
	{
		$nbMedia = intval($this->getRequestParameter("nbMedia"));
		$nbImage = intval($this->getRequestParameter("nbImage")) > 0 ? $this->getRequestParameter("nbImage") : m_medias_actions_block_MceFolderContentAction::$defaultNbImg;
		$numPage = intval($this->getRequestParameter("numPage")) > 0 ? $this->getRequestParameter("numPage") : 1;

		$nbPageTot = ceil($nbMedia/$nbImage);

		if($nbPageTot > 0)
		{
			$this->addToModel("nbPageTot", $nbPageTot);
			$this->addToModel("nbImage", $nbImage);
			$this->addToModel("numPage", $numPage);
			$this->setView('success');			
		}
		else
		{
			return "";			
		}

	}
}